www.gusucode.com > 落叶冰点万能企业网站内容管理系统 V9.1 > 落叶冰点万能企业网站内容管理系统 V9.1\code\admin\admin_usergroup\D_send_mail_toall.asp
<% '************************************************************** ' 新动软网站管理系统 ' 官方网站: http://www.aspcpu.com ' 系统作者: 阮丁远(网名:天下程序) ' Copyright 新动软网站管理系统 版权所有 '************************************************************** %> <LINK href="../css.css" type=text/css rel=stylesheet> <% dir_set="../../" Server.ScriptTimeout = 99999 %> <!--#include file=../../inc/conn.asp--> <!--#include file=../../inc/Functionb.asp--> <!--#include file=../../inc/ajaxLIB.asp--> <!--#include file=../inc/checkadmin2.asp--> <!--#include file=../../inc/functionFiless.asp--> <style type="text/css"> <!-- .STYLE3 { color: #FFFFFF; font-weight: bold; } --> </style> <div id="divProcessing" style="width:200px;height:30px;position:absolute;display:none"> <table border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" width="100%" height="100%"><tr><td bgcolor=#0650D2><marquee align="middle" behavior="alternate" scrollamount="5" style="font-size:9pt"><font color=#FFFFFF>...正在保存远程图片...请等待...</font></marquee></td></tr></table> </div> <br /> <% if find_dataw("qitashezhi123","0",14)<>"1" and qx_if_max=0 then response.redirect "../D_suodinguser.asp" end if sys_content_type=trim(request("sys_content_type")) %> <script src="../../ND_editor/FCKeditor2_5/FCKeditor.js"></script> <script type="text/javascript"> <!-- function remoteUpload(o) { try{ var strText = GetContentHTML() ; var divProcessing=document.getElementById("divProcessing"); var objField = document.getElementsByName("content_UploadText")[0]; objField.value = strText ; if (o) { divProcessing.style.top = 800 ; divProcessing.style.left = 200 ; divProcessing.style.display = ""; document.remoteuploadb.submit(); }else{ divProcessing.style.display = "none"; } } catch(e){} } function remoteUploadok() { try{ divProcessing.style.display = "none"; } catch(e){} } function GetContentHTML(){ var strHTML ; try{ var oEditor = FCKeditorAPI.GetInstance('Content') ; strHTML = oEditor.GetXHTML() } catch(e){ strHTML = ''; } return strHTML } var sLinkOriginalFileName = "originalfilename" ; var sLinkSaveFileName = "savefilename" ; var sLinkSavePathFileName = "UploadFileList" ; function addUploadFile(originalFileName, saveFileName, savePathFileName){ doInterfaceUpload(sLinkOriginalFileName, originalFileName); doInterfaceUpload(sLinkSaveFileName, saveFileName); doInterfaceUpload(sLinkSavePathFileName, savePathFileName); } function doInterfaceUpload(strLinkName, strValue){ if (strValue=="") return; if (strLinkName){ var objLinkUpload = document.getElementsByName(strLinkName)[0]; if (objLinkUpload){ if (objLinkUpload.value!=""){ objLinkUpload.value = objLinkUpload.value + "|"; } objLinkUpload.value = objLinkUpload.value + strValue; objLinkUpload.fireEvent("onchange"); } } } function doChange(objText, objDrop){ if (!objDrop) return; //if(document.myform.BriefTopic.selectedIndex<2){ // document.myform.BriefTopic.selectedIndex+=1; //} var str = objText.value; var arr = str.split("|"); var nIndex = objDrop.selectedIndex; objDrop.length=1; for (var i=0; i<arr.length; i++){ objDrop.options[objDrop.length] = new Option(arr[i], arr[i]); } objDrop.selectedIndex = nIndex; } //--> </script> <script language= JavaScript> function SelectPic(){ var arr=window.open('../D_select_upload_pic.asp', '', 'titlebar=no, toolbar=no, scrollbar=yes,Width=800, Height=600'); if(arr!=null){ //var ss=arr.split('|'); //document.all.myform.ImageUrl.value=ss[0]; //document.myform.ImageFileList.value=ss[0]; } else { alert("弹出窗口被系统拦截掉了,请修改你系统设置") } } </script> <% if cstr(request("do"))="1" then if trim(request("ytitle"))="" or request("ycont")="" then %> <script language="javascript"> alert("请填写好邮件标题和邮件内容"); history.go(-1); </script> <% response.end else response.Write "<br><br><br><br>" biao="[ND_user]" set rs=server.CreateObject("adodb.recordset") rs.open "select * from "&biao ,conn,1,1 do while not rs.eof emm=rs("email") if cstr(emm&"")<>"" and IsValidEmail(cstr(emm&""))=true then Subject=trim(request("ytitle")) Email=cstr(emm&"") restss=SendMailb(Subject, Email,rs("username")&",您好: "&trim(request("ycont"))) if restss="not_suputted" then mes="发送到邮箱:"&cstr(emm&"")&" 时发生错误(原因:服务器不支持邮件发送组件或您未在基本设置里指定邮件发送组件)<br><br>" end if if restss="OK" then mes="发送到邮箱:"&cstr(emm&"")&" 时成功....<br><br>" end if if restss="False" then mes="发送到邮箱:"&cstr(emm&"")&" 时发生错误(原因:发送失败,可能您在基本设置里指定的邮件登陆用户名或密码是错误的)<br><br>" end if response.Write mes response.Flush() end if rs.movenext loop response.Write "<br>已完成..<br>" response.Flush() response.end end if end if %> <form action="D_send_mail_toall.asp?do=1" method="post" target="_self" name="myform" id="myform"> <table height="30" width=730 border="0" cellpadding="2" cellspacing="0" bordercolor="#999999" style="border:#999999 1px"> <tr> <td> <table width=730 border="0" cellpadding="0" cellspacing="0" bordercolor="#999999"> <tr> <td height="32" align="center" class="adminth" colspan="4"><span class="STYLE3">邮件群发 (发给所有会员)</span></td> </tr> <% '**************************************************** '参数说明 'Subject : 邮件标题 'Email : 收件人邮件地址 'Content : 邮件内容 'is_for_qiye_mail 企业子系统不? '**************************************************** is_for_qiye_mail=0 Public Function SendMailb(Subject, Email, Content) ' On Error Resume Next SendMailb="not_suputted" biao2="[ND_sys]" if is_for_qiye_mail=1 then biao2="[ND_sys]" set rs22t=server.CreateObject("adodb.recordset") rs22t.open "select top 1 * from "&biao2&" where type='config_settings_qiye'",conn,1,1 else set rs22t=server.CreateObject("adodb.recordset") rs22t.open "select top 1 * from "&biao2&" where type='config_settings'",conn,1,1 end if ddd1tt=rs22t("data") dddd12tt=split(ddd1tt,"|") SiteNamexx=cstr(trim(dddd12tt(2)&" ")) comtype=cstr(dddd12tt(7)) if comtype="0" then SendMailb ="not_suputted" exit function end if LoginName=cstr(trim(dddd12tt(10)&" ")) LoginPass=cstr(trim(dddd12tt(11)&" ")) MailAddress=cstr(trim(dddd12tt(9)&" ")) Fromer=cstr(trim(dddd12tt(8)&" ")) if comtype="1" then Set jmail = Server.CreateObject("JMAIL.Message") '建立发送邮件的对象 jmail.silent = true '屏蔽例外错误,返回FALSE跟TRUE两值j jmail.Charset = "GB2312" '邮件的文字编码为国标 jmail.ContentType = "text/html" '邮件的格式为HTML格式 jmail.AddRecipient Email '邮件收件人的地址 jmail.From = Fromer '发件人的E-MAIL地址 jmail.FromName = SiteNamexx If LoginName <> "" And LoginPass <> "" Then JMail.MailServerUserName = LoginName '您的邮件服务器登录名 JMail.MailServerPassword = LoginPass '登录密码 End If If Err Then SendMailb ="not_suputted" exit function end if jmail.Subject = Subject '邮件的标题 JMail.Body = Content JMail.Priority = 1'邮件的紧急程序,1 为最快,5 为最慢, 3 为默认值 Flagaa=jmail.Send(MailAddress) '执行邮件发送(通过邮件服务器地址) jmail.Close() '关闭对象 Set JMail = Nothing If Flagaa Then SendMailb = "OK" Else SendMailb = "False" End If Exit function end if if comtype="2" then Set objCDOMail = Server.CreateObject("CDONTS.NewMail") objCDOMail.From = Fromer '邮件地址 objCDOMail.To = Email objCDOMail.Subject = Subject objCDOMail.BodyFormat = 0 objCDOMail.MailFormat = 0 objCDOMail.Body = Content If Err <> 0 Then SendMailb="not_suputted" Else objCDOMail.Send If Err <> 0 Then SendMailb="False" Else SendMailb="OK" End If End If Set objCDOMail = Nothing exit function end if if comtype="3" then Set Mailer=Server.CreateObject("Persits.MailSender") Mailer.Charset = "gb2312" Mailer.IsHTML = True Mailer.username = LoginName '服务器上有效的用户名 Mailer.password = LoginPass '服务器上有效的密码 Mailer.Priority = 1 'Mailer.Host = Mailer.Host =MailAddress Mailer.Port = 25 ' 该项可选.端口25是默认值 Mailer.From = Fromer '邮件地址 Mailer.FromName = SiteNamexx ' 该项可选 Mailer.AddAddress Email,Email Mailer.Subject = Subject Mailer.Body = Content If Err <> 0 Then SendMailb="not_suputted" Else Mailer.Send If Err <> 0 Then SendMailb="False" Else SendMailb="OK" End If End If Set Mailer = Nothing exit function end if if comtype="CDO.Message" then If Not IsObject(cdoConfig) Then sch = "http://schemas.microsoft.com/cdo/configuration/" Set cdoConfig = Server.CreateObject("CDO.Configuration") With cdoConfig.Fields .Item(sch & "smtpserver") = MailAddress '--SMTP 服务器 '.Item(sch & "smtpserverport") = 25 .Item(sch & "sendusing") = 2 .Item(sch & "smtpaccountname") = SiteNamexx .Item(sch & "sendemailaddress") = Fromer .Item(sch & "smtpuserreplyemailaddress") = 25 '.Item(sch & "smtpauthenticate") = cdoBasic .Item(sch & "sendusername") = LoginName .Item(sch & "sendpassword") = LoginPass .update End With If Err<>0 Then SendMailb="False" exit function End If End If Set Obj = Server.CreateObject("CDO.Message") With Obj Set .Configuration = cdoConfig .To = Email .Subject = Subject .TextBody = Content .Send End With Set Obj = Nothing Set cdoConfig = Nothing If Err<>0 Then SendMailb="False" Else SendMailb="OK" End If exit function end if end function function IsValidEmail(email) dim names, name, i, c IsValidEmail = true names = Split(email, "@") if UBound(names) <> 1 then IsValidEmail = false exit function end if for each name in names if Len(name) <= 0 then IsValidEmail = false exit function end if for i = 1 to Len(name) c = Lcase(Mid(name, i, 1)) if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then IsValidEmail = false exit function end if next if Left(name, 1) = "." or Right(name, 1) = "." then IsValidEmail = false exit function end if next if InStr(names(1), ".") <= 0 then IsValidEmail = false exit function end if i = Len(names(1)) - InStrRev(names(1), ".") if i <> 2 and i <> 3 then IsValidEmail = false exit function end if if InStr(email, "..") > 0 then IsValidEmail = false end if end function %> <tr> <td width="250" height="27" align="center" bgcolor="#ffffff"><strong>邮件标题:</strong></td> <td width="480" align="left" bgcolor="#EDF8FE" colspan="3"> <input name="ytitle" type="text" value="" size="60"/> <font color="red">*</font></td> </tr> <tr> <td width="250" height="288" align="center" bgcolor="#ffffff"><strong>邮件内容:</strong></td> <td width="480" align="left" bgcolor="#EDF8FE" colspan="3"> <textarea name="ycont" cols="60" rows="20"></textarea> <font color="red">*</font></td> </tr> <tr> <td height="30" align="center" bgcolor="#D5EFFD" colspan="4"> <input type="submit" value="开始邮件群发" /></td> </tr> <tr> <td height="80" align="center" bgcolor="#ffffff" colspan="4"></td> </tr> </table> </td> </tr> </table> <input type="hidden" name="sys_content_type" value="<%=request("sys_content_type")%>"/> <input type="hidden" name="id" value="<%=request("id")%>"/> </form>